/*
 * Light.cpp
 *
 *  Created on: Jun 5, 2016
 *      Author: Yang
 */

#include "Light.hpp"

LIB_Light Light_task;

void LED_ON(uint16_t LED)
{
    GPIO_ResetBit(LED);
}
void LED_OFF(uint16_t LED)
{
    GPIO_SetBit(LED);
}


void RunningLight_Task_Init(float fre)
{
	hal.Hard_delay_ms(10);
	Light_task.task_frequency = fre;
    console.printf((char*) "LED Initialize                                    [OK]\r\n");
}

void RunningLight_Task_Loop(void *pvParameters)
{
    uint8_t flag = 0;

    for (;;)
    {
        if (flag)
            LED_ON (LED1);
        else
            LED_OFF(LED1);
        flag = ~flag;
        hal.RTOSdelay_ms(1000/Light_task.task_frequency);
    }
}
